import request from '@/config/axios'

//获取列表
export const getClusterTaskPage = (params) => {
  return request.getOriginal({
    url: '/amp/cluster-task/page',
    params
  })
}

// 查询聚类任务详情
export const getClusterTask = (id: number | string) => {
  return request.get({ url: '/amp/cluster-task/get?id=' + id })
}

// 新增任务
export const createClusterTask = (data) => {
  return request.post({ url: '/amp/cluster-task/create', data: data })
}

// 修改材料
// export const updateMaterial = (params) => {
//   return request.put({ url: '/amp/material-message/update', data: params })
// }

// 删除任务
export const deleteClusterTask = (id: number) => {
  return request.delete({ url: '/amp/cluster-task/delete?id=' + id })
}

// 创建聚类结果
export const createClusterResult = (data) => {
  return request.post({ url: '/amp/cluster-result/create', data: data })
}

// 删除聚类结果
export const deleteClusterTaskResult = (id: number) => {
  return request.delete({ url: '/amp/cluster-result/delete?id=' + id })
}

// 根据聚类任务id获得聚类结果列表
export const getClusterTaskResult = (id: number | string) => {
  return request.get({ url: '/amp/cluster-result/get-by-task?id=' + id })
}

// 编辑聚类结果
export const updateClusterResult = (params) => {
  return request.put({ url: '/amp/cluster-result/update', data: params })
}

//根据聚类结果id获得聚类详情
export const getClusterTaskResultInfo = (id: number | string, fileName) => {
  return request.get({
    url: '/amp/cluster-result/get-file-info-by-result?id=' + id + '&fileName=' + fileName
  })
}

// 下发文件
export const fileToAsset = (data) => {
  return request.post({ url: '/amp/cluster-result/to-asset', data: data })
}

// 添加至文件管理
export const fileToManage = (data) => {
  return request.post({ url: '/amp/cluster-result/to-file-manage', data: data })
}

// 导出聚类结果
export const exportClusterResult = async (params) => {
  return await request.download({ url: '/amp/cluster-result/export-text', params })
}

//删除聚类结果文件
export const deleteClusterResultFile = async (data) => {
  return await request.delete({ url: '/amp/cluster-result/delete', data })
}

//编辑聚类结果文件
export const editClusterResultFile = async (data) => {
  return await request.put({ url: '/amp/cluster-result/update', data })
}
